package com.yyk.yykywd.mvvm.ui

import androidx.recyclerview.widget.GridLayoutManager
import com.yyk.yykywd.CONTRACT_IMG
import com.yyk.yykywd.R
import com.yyk.yykywd.base.BaseActivity
import com.yyk.yykywd.config.HttpUrl
import com.yyk.yykywd.mvvm.adapter.ImageViewAdapter
import com.yyk.yykywd.util.DensityUtils
import com.yyk.yykywd.util.ToAnotherActivity
import com.yyk.yykywd.widght.SpaceItemDecoration
import kotlinx.android.synthetic.main.activity_contract_img.*

class ContractImgActivity : BaseActivity() {
    override fun initData() {
    }

    override fun getLayoutId(): Int {
        return R.layout.activity_contract_img
    }

    override fun initView() {
        val list = intent.getStringArrayListExtra(CONTRACT_IMG)

        setBackArrow()
        setTitle("合同图片")

        rv.layoutManager = GridLayoutManager(mActivity, 3)
        rv.addItemDecoration(SpaceItemDecoration(DensityUtils.dp2px(mActivity, 15f)))
        val imageViewAdapter = ImageViewAdapter(mActivity, R.layout.item_iv, list)
        rv.adapter = imageViewAdapter

        imageViewAdapter.setOnItemClickListener { _, _, position ->
            ToAnotherActivity.toPicActivity(mActivity, HttpUrl.BASE_URL + list[position])
        }
    }

}
